<template>
	<view class="">
		<view>
			<liu-slide-img :heightNumber="630" :list="listPoster" :autoplay="autoplay" :interval="interval"
				@click="clickSlideImg"></liu-slide-img>
		</view>
		<!-- <view class="bgIndex ">


		</view> -->
		<view class="flex-between padding20" v-if="daziInfoObject">
			<view class="flex-start-center">

				<image class="img" :src="daziInfoObject.avatar" mode=""></image>
				<view class="margin-left_10rpx">
					<view class="font-weight">
						{{daziInfoObject.nickname}}
						<!-- {{JSON.stringify(daziInfoObject)}} -->
					</view>
					<view class="flex">
						<text style="margin-right: 8rpx;">报名截止</text><cc-countdown color="#FFF"
							background-color="#A561FF" splitorColor="#A561FF" :showColon="true" :showDay="true"
							:day="daziInfoObject.expire_timeObject.days" :hour="daziInfoObject.expire_timeObject.hours"
							:minute="daziInfoObject.expire_timeObject.minutes"
							:second="daziInfoObject.expire_timeObject.seconds" @timeup="timeup"></cc-countdown>
					</view>

				</view>
			</view>

			<view class="flex" v-if="daziInfoObject&&daziInfoObject.dazi_join_user">
				<!-- <view class="flex-column" style="margin-right: 35rpx;"
					@click="getWechat(daziInfoObject.wechat,daziInfoObject.dazi_join_user)">
					<image class="wxImg" :src="wx" mode="widthFix"></image>
					微信号
				</view> -->
				<view class="flex-column margin-right_30rpx" @click="sharePoster()">
					<image class="wxImg" :src="daziShare" mode="widthFix"></image>
					<text style="color: rgb(102, 102, 102);">分享</text>
				</view>
				<view class="flex-column" @click="getPhone(daziInfoObject.phone,daziInfoObject.dazi_join_user)">
					<image class="wxImg" :src="daziPhone" mode="widthFix"></image>
					<text style="color: rgb(102, 102, 102);">电话</text>
				</view>
			</view>
		</view>
		<view class=" font-overflow " style="padding: 20rpx 20rpx;" v-if="daziInfoObject">

			<view class=" font-overflow flex-start-center">

				<view class="" v-for="(content,index) in daziInfoObject.label" :key="index">

					<view class="tagTitleOrange  flex">
						{{content}}
					</view>
				</view>


			</view>



		</view>
		<!-- <block v-if="daziInfoObject&&daziInfoObject.describe">
			
			<mote-lines-divide :line="4" :dt="daziInfoObject.describe" expandText="展开" foldHint="收起">
			
			</mote-lines-divide>
		</block> -->

		<!--  -->
		<view class="" style="height: 16rpx;background-color: #eeeeee;">

		</view>

		<view class="padding20 flex-start-center" v-if="daziInfoObject">
			<image class="detailsGenderImg" :src="detailsGender" mode="widthFix"></image>
			<view class="flex-start-center">
				<view style="color: #666666;">搭档性别类型 : </view>
				<view class="" style="margin-left: 8rpx;">
					{{(daziInfoObject.sex==1||daziInfoObject.sex==0)?'性别不限':daziInfoObject.sex==2?'性别比例':''}}
				</view>
			</view>
		</view>


		<view class="padding20 flex-start-center"
			v-if="(daziInfoObject&&daziInfoObject.dazi_join_user)&&(daziInfoObject.sex==1||daziInfoObject.sex==0)">
			<image class="detailsGenderImg" :src="detailsUser" mode="widthFix"></image>
			<view class="flex-start-center">
				<view style="color: #666666;">参与人数 : </view>
				<view class="" style="margin-left: 8rpx;">
					已报名{{daziInfoObject.participants_number}}人，共计{{daziInfoObject.people_number}}人</view>
			</view>
		</view>
		<view class="padding20 flex-start-center"
			v-if="(daziInfoObject&&daziInfoObject.dazi_join_user)&&daziInfoObject.sex==2">
			<image class="detailsGenderImg" :src="detailsUser" mode="widthFix"></image>
			<view class="flex-start-center">
				<view style="color: #666666;">参与人数 : </view>
				<view class="flex-start-center" style="margin-left: 8rpx;">
					<view class="flex">
						<image class="sexIcon" :src="sexNv" mode=""></image>
						<text style="margin-left: 8rpx;">{{daziInfoObject.woman_participants_number}}</text>
					</view>
					<view class="flex margin-left_16rpx">
						<image class="sexIcon" :src="sexNan" mode=""></image>
						<text style="margin-left: 8rpx;">{{daziInfoObject.man_participants_number}}</text>
					</view>
					<view class="margin-left_16rpx">
						共计{{(daziInfoObject.woman_number)+(daziInfoObject.man_number)}}人
					</view>
				</view>
			</view>
		</view>
		<view class="padding20 flex-start-center"
			v-if="(daziInfoObject&&daziInfoObject.price)&&(daziInfoObject.sex==1||daziInfoObject.sex==0)">
			<image class="detailsGenderImg" :src="detailsPrice" mode="widthFix"></image>
			<view class="flex-start-center">
				<view style="color: #666666;">搭子费 : </view>
				<view style="margin-left: 8rpx;"  :style="userInfo.level_id!=1 ? 'color: #c5c5c5;margin-right: 8rpx;text-decoration: line-through;' : 'color: #494FFF;margin-right: 8rpx;'"  >{{daziInfoObject.price}}{{currency_name}}
				</view>
				
				<view v-if="userInfo.level_id!=1" class="" style="color: #494FFF;margin-left: 8rpx;">{{(daziInfoObject.price*((Number(basicConfiguration.dazi_level_discount))/100)).toFixed(2)}}{{currency_name}}
				</view>
			</view>
		</view>
		<view class="padding20 flex-start-center" v-if="(daziInfoObject&&daziInfoObject.price)&&daziInfoObject.sex==2">
			<image class="detailsGenderImg" :src="detailsPrice" mode="widthFix"></image>
			<view class="flex-start-center">
				<view style="color: #666666;">搭子费 : </view>
				<view style="margin-left: 8rpx;"  class="" :style="userInfo.level_id!=1 ? 'color: #c5c5c5;margin-right: 8rpx;text-decoration: line-through;' : 'color: #494FFF;margin-right: 8rpx;'" >
					{{userInfo.sex==1?daziInfoObject.man_price:daziInfoObject.woman_price}}{{currency_name}}
				</view>
				
				<view  v-if="userInfo.level_id!=1" class="" style="color: #494FFF;margin-left: 8rpx;">{{(userInfo.sex==1?daziInfoObject.man_price*((Number(basicConfiguration.dazi_level_discount))/100).toFixed(2):daziInfoObject.woman_price*((Number(basicConfiguration.dazi_level_discount))/100)).toFixed(2)}}{{currency_name}}
				</view>
				
				
			</view>
		</view>
		<view class="padding20 flex-start-center" v-if="daziInfoObject&&daziInfoObject.activity_time">
			<image class="detailsGenderImg" :src="detailsTime" mode="widthFix"></image>
			<view class="flex-start-center">
				<view style="color: #666666;">活动开始时间 : </view>
				<view class="" style="margin-left: 8rpx;">{{expireTimeFn(daziInfoObject.activity_time)}}</view>
			</view>
		</view>

		<view class="padding20 " v-if="daziInfoObject&&daziInfoObject.address">


			<view class="flex-between">
				<view class="flex-start-center">
					<image class="detailsGenderImg" :src="detailsDw" mode="widthFix"></image>

					<view class="flex-start-center ">
						<view style="color: #666666;">活动地址 : </view>
						<view class="font-overflow" style="margin-left: 8rpx;max-width: 400rpx;">
							{{daziInfoObject.address}}
						</view>
					</view>
				</view>
				<view style="color: #3853FF;" class="" @click="addressFn(daziInfoObject)">
					导航 <uni-icons color="#3853FF" type="right" size="15"></uni-icons>
				</view>
			</view>

		</view>





		<!-- 组队信息 -->

		<!-- 	<view class="flex-between padding20" v-if="(daziInfoObject.sex==1||daziInfoObject.sex==0)">
			<view class="font-weight ">

				{{'组队信息（' + daziInfoObject.participants_number + '/' + daziInfoObject.people_number + '）'}}
			</view>
			<view @click="oneClickKicking(daziInfoObject.id)" class=""
				v-if="isHost&&daziInfoObject&&daziInfoObject.dazi_join_user.length">
				一键踢人
			</view>
		</view>

		<view class="flex-between padding20" v-if="(daziInfoObject.sex==2)">
			<view class="font-weight ">

				{{'组队信息（' + (daziInfoObject.woman_participants_number+daziInfoObject.man_participants_number) + '/' +( daziInfoObject.woman_number+daziInfoObject.man_number) + '）'}}
			</view>
			<view @click="oneClickKicking(daziInfoObject.id)" class=""
				v-if="isHost&&daziInfoObject&&daziInfoObject.dazi_join_user.length">
				一键踢人
			</view>
		</view> -->
		<view class="" style="height: 16rpx;background-color: #eeeeee;">

		</view>
		<view class="padding20 flex-between" @click="sortBolFn()">
			<view class="flex-start-center">
				<view class="flex-between v-p-share" v-if="daziInfoObject&&daziInfoObject.dazi_join_user.length">
					<view class="v-m-width not-font-overflow flex1">
						<block v-for="(img, index) in daziInfoObject.dazi_join_user" :key="index">
							<image v-if="index<10" class="pt_img" :src="img.avatar"></image>
						</block>
						<image class="pt_img" :src="headDazi" mode=""></image>
					</view>

				</view>


			</view>
			<view class="">
				<view class="flex-between " v-if="(daziInfoObject.sex==1||daziInfoObject.sex==0)">
					<view class="flex">

						{{'组队信息(' + daziInfoObject.participants_number + '/' + daziInfoObject.people_number + ')'}}
						<uni-icons type="right" size="15"></uni-icons>
					</view>

				</view>

				<view class="flex-between " v-if="(daziInfoObject.sex==2)">
					<view class=" ">

						{{'组队信息（' + (daziInfoObject.woman_participants_number+daziInfoObject.man_participants_number) + '/' +( daziInfoObject.woman_number+daziInfoObject.man_number) + '）'}}
						<uni-icons type="right" size="15"></uni-icons>
					</view>

				</view>
			</view>
		</view>
		<view class="" style="height: 16rpx;background-color: #eeeeee;">

		</view>
		<view class="" style="height: 16rpx;">

		</view>
		<view class="padding_0_20rpx ">
			<view class="flex-start-center ">
				<view class="line">

				</view>
				<view class="font-weight">
					搭子详情
				</view>
			</view>
			<uv-parse :content="daziInfoObject.describe" :selectable="true"></uv-parse>
<!-- 			<rich-parser style="padding: 20rpx 20rpx 20rpx 0;color: #333333;" :html="daziInfoObject.describe"
				domain="https://6874-html-foe72-1259071903.tcb.qcloud.la" lazy-load ref="article" selectable
				show-with-animation use-anchor lazyLoad="true"></rich-parser> -->
		</view>
		<sunui-popup ref="mployeeInfo">
			<template v-slot:content>

				<view class="daziDetailPopup" style="background: #FFFFFF">
					<scroll-view :scroll-y="true" style="height: 700rpx;">
						<view v-if="daziInfoObject&&daziInfoObject.dazi_join_user.length">

							<view class="padding20 font-weight">
								<view class="flex-between " v-if="(daziInfoObject.sex==1||daziInfoObject.sex==0)">
									<view class="flex">

										{{'组队信息(' + daziInfoObject.participants_number + '/' + daziInfoObject.people_number + ')'}}

									</view>
									<!-- 	<view @click="oneClickKicking(daziInfoObject.id)" class=""
									v-if="isHost&&daziInfoObject&&daziInfoObject.dazi_join_user.length">
									一键踢人
								</view> -->
								</view>

								<view class="flex-between " v-if="(daziInfoObject.sex==2)">
									<view class=" ">

										{{'组队信息（' + (daziInfoObject.woman_participants_number+daziInfoObject.man_participants_number) + '/' +( daziInfoObject.woman_number+daziInfoObject.man_number) + '）'}}
									</view>
									<!-- <view @click="oneClickKicking(daziInfoObject.id)" class=""
									v-if="isHost&&daziInfoObject&&daziInfoObject.dazi_join_user.length">
									一键踢人
								</view> -->
								</view>
							</view>
							<view class="" v-for="(item,index) in daziInfoObject.dazi_join_user" :key="index">
								<view class="flex-between padding20 border-bottom-ECECEC">
									<view class="flex-start-center">
										<view class="dw">
											<image class="img" :src="item.avatar" mode=""></image>
											<view class="dwSex flex-start-center margin-left_16rpx">
											
												<view class="male flex" v-if="item.sex==1">
													<image v-if="item.sex==1" class="maleImg" :src="path25"
														mode="widthFix"></image>
											
													<text>{{item.age}}</text>
											
												</view>
												<view class="female flex" v-if="item.sex==2">
											
													<image v-if="item.sex==2" class="femaleImg" :src="path69"
														mode="aspectFit">
													</image>
													<text>{{item.age}}</text>
											
												</view>
											
											
											</view>
										</view>
										<view class="margin-left_10rpx">
											<view class="flex-start-center">

												<view class="font-weight font-overflow" style="max-width: 310rpx;">
													{{item.nickname}}
												</view>
												<view class="">
													<view v-if="item.level_id==1" class="">
														<image class="noVip" src="https://z4a.net/images/2024/07/17/-1617.png" mode="widthFix">
														</image>
													</view>
													<view class="" v-else>
														<image class="Vip" src="https://z4a.net/images/2024/07/17/-1134.png" mode="widthFix">
														</image>
													</view>
												</view>
												
											</view>
											<view class="flex-start-center">
												<text style="margin-right: 10rpx;">加入时间：{{item.create_time}}</text>

											</view>
										</view>
									</view>
									<view style="color: #8B8B8B;" class="flex-start-center">
										<view class="">
											已加入
										</view>
										<view v-if="isHost" class=""
											@click="whoCanSeeIt(item.id,daziInfoObject,item.uid)">
											<image class="threePoints" :src="threspoints" mode=""></image>
										</view>
									</view>
								</view>

							</view>

						</view>
						<view class="flex" v-else>
							<image :src="none1" mode=""></image>

						</view>
					</scroll-view>
				</view>

			</template>
		</sunui-popup>





		<view style="height: 120rpx;">

		</view>

		<view v-if="(!isHost&&joinFeeBol&&!isFullStarffed)&& (daziInfoObject.sex==1||daziInfoObject.sex==0)"
			class="addTieziBtn flex" @click="joiningFeeFn(daziInfoObject.id)">
			加入费：{{ userInfo.level_id!=1?(daziInfoObject.price*((Number(basicConfiguration.dazi_level_discount))/100)).toFixed(2):daziInfoObject.price?daziInfoObject.price:'-'}}{{currency_name}}
		</view>
		<view v-if="(!isHost&&joinFeeBol&&!isFullStarffed)&&daziInfoObject.sex==2" class="addTieziBtn flex"
			@click="joiningFeeFn(daziInfoObject.id)">
			加入费：{{userInfo.level_id!=1?userInfo.sex==1? (daziInfoObject.man_price*((Number(basicConfiguration.dazi_level_discount))/100)).toFixed(2):(daziInfoObject.woman_price*((Number(basicConfiguration.dazi_level_discount))/100)):userInfo.sex==1?daziInfoObject.man_price:daziInfoObject.woman_price}}{{currency_name}}
		</view>
		<view class="">
			<view class="addDaZiBtn flex-end" v-if="isHost">

				<view v-if="deadlineRegistrationFn(daziInfoObject.expire_time,daziInfoObject.status)"
					class="deadlineRegistration flex" @click="endTimeFn(daziInfoObject.id)">
					截止报名
				</view>
			</view>
			<view
				v-if="!((!isHost&&joinFeeBol&&!isFullStarffed)&&(daziInfoObject.sex==1||daziInfoObject.sex==0||daziInfoObject.sex==2))"
				:class="[isHost&&deadlineRegistrationFn(daziInfoObject.expire_time,daziInfoObject.status)?'HomepageBtn flex':'HomepageBtn-active flex']"
				@click="returnHomepageFn()">
				返回首页
			</view>
		</view>
		<!--  -->
		<sunui-popup ref="modifyEmployeeInfo">
			<template v-slot:content>

				<view class="moreActiveButton">
					<view v-if="itemObject.status!=5" class="add" @click.stop="authorityFn(1)">
						踢掉此人
					</view>
					<view class="add" @click.stop="authorityFn(2)">
						查看主页
					</view>
					<view class="add" @click.stop="authorityFn(3)">
						私聊TA
					</view>

				</view>

			</template>
		</sunui-popup>


		<sunui-popup ref="generatePoster">
			<template v-slot:content>

				<view class="generatePoster">


				</view>

			</template>
		</sunui-popup>
		<sunui-popup ref="phoneLogin">
			<template v-slot:content>
		
				<view class="padding20" style="background-color: #FFFFFF;">
					<view class="text-align_center margin-top_20rpx font-weight_bold">
						手机号校验将会赠送你{{phone_number_authentication_send_coins}}{{currency_name}}
					</view>
					<view>
					
					
						<view class="margin_40rpx_0">
							手机号
						</view>
					
						<view class="getPhone flex  ">
					
							<input v-model="form.phone" type="number" maxlength="11" name="phone" placeholder="请输入手机号" />
					
					
						</view>
					
					
					
					</view>
					<view >
						<view class="margin_40rpx_0">
							验证码
						</view>
						<view class="getPhone flex  ">
						
							<input v-model="form.sms_code" type="number" maxlength="11" name="phone" placeholder="请输入验证码" />
						
							<!-- <button type="primary" size="mini" class="ckPhone" open-type="getPhoneNumber"
								@getphonenumber="onGetPhoneNumber">获取手机号</button> -->
						 <view class="verificationCode" @click="getVerificationCode()" >{{ count ? count + '秒' : '获取验证码' }}</view>
						
						</view>
					
						
					</view>
					<view class="phoneBtn flex" @click="closeBtn()">
						确定
					</view>
				</view>
		
			</template>
		</sunui-popup>

	</view>
</template>

<script>
	import MoteLinesDivide from "../../components/mote-lines-divide/mote-lines-divide.vue"

	export default {
		components: {
			MoteLinesDivide,

		},
		data() {
			return {
				headDazi: this.$img.headDazi,
				detailsGender: this.$img.detailsGender,
				detailsUser: this.$img.detailsUser,
				detailsDw: this.$img.detailsDw,
				detailsPrice: this.$img.detailsPrice,
				detailsTime: this.$img.detailsTime,
				path25: this.$img.path25,
				path69: this.$img.path69,
				sexNan: this.$img.sexNan,
				sexNv: this.$img.sexNv,
				currency_name: uni.getStorageSync("system").currency_name,
				phone_number_authentication_send_coins:uni.getStorageSync("system").phone_number_authentication_send_coins,
				none1: this.$img.none1,
				threspoints: this.$img.threspoints,
				wx: this.$img.wx,
				phone: this.$img.phone,
				daziPhone: this.$img.daziPhone,
				daziShare: this.$img.daziShare,
				explain: "吃到了我想吃的番茄牛腩锅!!拌饭真的一绝!意满离!中午来吃的没想到中午店里也这么多人!两个人一份锅够够!我朋友想吃辣锅我想吃番茄锅两个都安排上也吃到了我想吃的番茄牛腩锅!!拌饭真的一绝!意满离!中午来吃的没想到中午店里也这么多人!两个人一份锅够够!我朋友想吃辣锅我想吃番茄锅两个都安排上也吃到了我想吃的番茄牛腩锅!!拌饭真的一绝!意满离!中午来吃的没想到中午店里也这么多人!两个人一份锅够够!我朋友想吃辣锅我想吃番茄锅两个都安排上也",
				daziInfoObject: null,
				userInfo: uni.getStorageSync("userInfo"),
				listPoster: [],
				isHost: false,
				kickUserId: null,
				id: null,
				joinFeeBol: true,
				isFullStarffed: false,
				dazi_join_user: [],
				itemObject: null,
				interval: 3000,
				autoplay: true,
				uidGo: '',
				joinMan: '',
				joinWoman: '',
				isAndroid: true,
				is_show_model: true,
				shareType: uni.getStorageSync("shareType") ? uni.getStorageSync("shareType") : '',
				id: uni.getStorageSync("detailId") ? uni.getStorageSync("detailId") : '',
				form:{
					phone:'',
					sms_code:''
				},
				count:0,
				disableCode: false,
				basicConfiguration:{}




			}
		},

		onLoad(options) {
			this.basicConfigurationFn()
			this.navigationList()
			console.log(options)
			this.id = options.id
			this.daziInfoFn(options.id)
			wx.getSystemInfo({
				success: (res) => {
					let platform = res.system;

					if (platform.indexOf('Android') !== -1) {
						this.isAndroid = true

						console.log('用户使用安卓设备');

					} else if (platform.indexOf('iOS') !== -1) {
						this.isAndroid = false
						// uni.showModal({
						// 	title: '提示',
						// 	content: '是否跳转到联系我们页面',
						// 	success: async (res) => {
						// 		if (res.confirm) {
						//              this.$sun.navGo('/pagesA/personalCenter/contactUs')

						// 		} else if (res.cancel) {

						// 		}
						// 	}
						// });
						console.log('用户使用苹果设备');
					}
				}
			});


		},
		computed: {

			// 订单状态 '1 待审核 2 上架中 3 下架 4 驳回',
			expireTimeFn: function() {
				return function(timestamp) {

					// 创建一个 Date 对象
					const date = new Date(timestamp * 1000); // 需要将秒转换为毫秒

					// 获取年、月、日、小时、分钟
					const year = date.getFullYear();
					const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始计算，需要+1，并且补零
					const day = String(date.getDate()).padStart(2, '0'); // 补零
					const hours = String(date.getHours()).padStart(2, '0'); // 补零
					const minutes = String(date.getMinutes()).padStart(2, '0'); // 补零

					// 拼接成 "年月日 时分" 格式
					const formattedDate = `${year}年${month}月${day}日 ${hours}时${minutes}分`;

					return formattedDate
				};
			},
			deadlineRegistrationFn() {

				return function(time, status) {
					console.log(Math.floor(Date.now() / 1000), time, status)
					if (Math.floor(Date.now() / 1000) > time) {
						return false
					} else {
						return true
					}
				}

			},
		},
		methods: {
			async basicConfigurationFn() {
				const result = await this.$http.post({
					url: this.$api.config,
					data: {},
					headers: {
			
					}
			
				})
				if (result.code == 0) {
					console.log(result)
					this.basicConfiguration = result.data
			
					wx.setStorageSync('system', result.data);
			
			
				}
			},
			async userInfoFn() {
				const result = await this.$http.post({
					url: this.$api.userInfo,
					data: {
			
			
			
			
					},
					headers: {
						'Authorization': this.userInfo.token
					}
			
				})
			
				if (result.code == 0) {
					console.log('data', result.data);
				
					wx.setStorageSync('userInfo', result.data);
				
			
				}
			},
			async phoneAuthenticationFn(){
				const result = await this.$http.post({
					url: this.$api.phoneAuthentication,
					data: {
							
							phoneNumber:this.form.phone,
							sms_code:this.form.sms_code,
							userId:this.userInfo.id
							
							
							
					},
					headers: {
						'Authorization': this.userInfo.token
					}
							
				})
							
				if (result.code == 0) {
					
					this.$sun.toast(result.message, 'none');
					this.userInfoFn()
					setTimeout(()=>{
						this.$refs.phoneLogin.close()
					},500)
				}else{
					console.log('data', result.data);
					this.$sun.toast(result.message, 'none');
					setTimeout(()=>{
						this.$refs.phoneLogin.close()
					},500)
				}
			},
			closeBtn(){
				
				this.phoneAuthenticationFn()
				
				
				
			},
			// 验证码码倒计60秒
			countDown(seconds) {
				this.count = seconds;
				var countdownTimer = setInterval(() => {
					this.count--;
					if (this.count === 0) {
						clearInterval(countdownTimer);
						this.disableCode = false;
						// 在这里可以触发验证码过期后的操作
					}
				}, 1000);
			},
			async getVerificationCode() {
				if (!this.disableCode) {
					
					if (/^1[3456789]\d{9}$/.test(this.form.phone)) {
						const result = await this.$http.post({
							url: this.$api.sendSmsRequest,
							data: {
							
								phone: this.form.phone
							}
						});
			
						if (result.code == 0) {
						
							this.disableCode = true;
							this.countDown(60);
						} else {
							this.$sun.toast(result.message, 'none');
						}
								
					} else {
						this.$sun.toast('请填写正确的手机号', 'none');
					}
				}
			},
			async navigationList() {
				const res = await this.$http.get({
					url: this.$api.menuAS,
					data: {


					},
					headers: {
						'Authorization': this.userInfo.token
					}

				})
				console.log(res.data)

				this.tabList = res.data.map((item) => {
					return {
						id: item.id,
						name: item.new_name,
						state: item.state
					}
				})


				// 需要判断下当前id 为1 和id 3

				const index1 = this.tabList.findIndex(item => item.id == 1);

				wx.setStorageSync('returnDazi', index1);

			},
			returnHomepageFn() {
				this.$sun.navRe('/pages/home/home', {
					currentIndex: uni.getStorageSync("returnDazi") ? uni
						.getStorageSync("returnDazi") : 0
				});
			},
			onShareAppMessage() {
				return {

					title: this.daziInfoObject.title ? this.daziInfoObject.title : '搭子详情',
					path: '/pages/index/index?invite=' + uni.getStorageSync("userInfo").invite_code + '&shareType=1&id=' +
						this.id,
					imageUrl: this.listPoster[0].img ? this.listPoster[0].img : wx.getStorageSync('system')
						.distribution_poster,
					desc: this.daziInfoObject.title ? this.daziInfoObject.title : '搭子详情',
				}
			},
			// 分享朋友圈(微信小程序)
			onShareTimeline() {
				return {
					title: this.daziInfoObject.title ? this.daziInfoObject.title : '搭子详情',
					path: '/pages/index/index?invite=' + uni.getStorageSync("userInfo").invite_code + '&shareType=1&id=' +
						this.id,
					imageUrl: this.listPoster[0].img ? this.listPoster[0].img : wx.getStorageSync('system')
						.distribution_poster,
					desc: this.daziInfoObject.title ? this.daziInfoObject.title : '搭子详情',
				}
			},

			sharePoster() {
				this.$sun.navGo('/pagesA/personalCenter/generatePoster');

				// this.$refs.myPackagePopup.show({
				// 	style: 'padding:50rpx;',
				// 	bottomClose: true,
				// 	shadeClose: true,
				// 	topclose: true
				// });
			},
			sortBolFn() {
				console.log('1111')
				this.$refs.mployeeInfo.show({
					anim: 'bottom',
					position: 'bottom',
					shadeClose: true, //false使用户不能点击其它关闭页面
					topclose: false,
					zIndex: 1000,

				});
			},
			async addressFn(tiem) {
				console.log(tiem.latitude, tiem.longitude)
				let latMap = Number(tiem.dimension)
				let lngMap = Number(tiem.longitude)
				//纬度
				//经度
				// var longitude = parseFloat(lngMap);
				uni.openLocation({
					latitude: latMap,
					longitude: lngMap,
					success: function() {
						console.log('success');
					}
				});
				// 百度地图经纬度转腾讯地图经纬度
				// var x_pi = 3.14159265358979324;
				// var x = parseFloat(latMap) - 0.0065;
				// var y = parseFloat(lngMap) - 0.006;
				// var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
				// var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
				// var lat = (z * Math.cos(theta)).toFixed(7);
				// var lng = (z * Math.sin(theta)).toFixed(7);
				// //定位地方名称
				// var name = tiem.merchantAddress;
				// const map = await this.$sun.openLocation({
				// 	//拿到上面的计算好的（百度经纬度转腾讯经纬度）经纬度 进行一个赋值
				// 	lat: latMap,
				// 	lng: lngMap,
				// 	name:tiem.merchantAddress, //名称
				// 	address: tiem.merchantAddress, //地址
				// 	key: 'SFABZ-WANWW-FISRY-3IGTF-HV7RE-YSFTI' //腾讯key
				// });
			},
			async endTimeFn(id) {
				if(this.userInfo.disable==0){
					this.$sun.toast('当前用户已经被拉黑','none')
				}else{
					uni.showModal({
						title: '提示',
						content: '是否要截止报名',
						success: async (res) => {
							if (res.confirm) {
					
								const res = await this.$http.post({
									url: this.$api.endTime,
									data: {
					
										id: id
									},
									headers: {
										'Authorization': this.userInfo.token
									}
					
								})
					
								if (res.code == 0) {
									this.$sun.toast(res.message, 'none')
									setTimeout(() => {
					
										this.$sun.navBack()
									}, 500)
					
								} else {
					
									this.$sun.toast(res.message, 'none')
								}
					
							} else if (res.cancel) {
					
							}
						}
					});
					
				}


			},
			whoCanSeeIt(id, item, uid) {
				console.log(item)
				this.itemObject = item
				this.kickUserId = id
				this.uidGo = uid
				console.log(this.uidGo)
				this.$refs.modifyEmployeeInfo.show({
					anim: 'bottom',
					position: 'bottom',
					shadeClose: true, //false使用户不能点击其它关闭页面
					topclose: false,
					// shade:false,
					zIndex: 100000

				});

			},


			async authorityFn(id) {
				if(this.userInfo.disable==0){
					this.$sun.toast('该用户已被拉黑','none')
				}else{
					if (id == 1) {
						const res = await this.$http.post({
							url: this.$api.kickUser,
							data: {
					
								id: this.kickUserId
					
							},
							headers: {
								'Authorization': this.userInfo.token
							}
					
						})
					
						if (res.code == 0) {
							this.$refs.modifyEmployeeInfo.close()
							this.$refs.mployeeInfo.close()
							setTimeout(() => {
								this.daziInfoFn(this.id)
								this.$sun.toast(res.message, 'none')
							}, 500)
					
						} else {
					
							this.$sun.toast(res.message, 'none')
						}
					
					
					} else if (id == 2) {
						this.$refs.modifyEmployeeInfo.close()
						this.$refs.mployeeInfo.close()
						this.$sun.navGo('/pagesB/index/socialDetails', {
							uid: this.uidGo
						})
					} else {
						this.$refs.modifyEmployeeInfo.close()
						this.$refs.mployeeInfo.close()
						setTimeout(() => {
							this.$sun.navGo('/pagesB/index/HM-chat/HM-chat', {
								uid: this.uidGo
							})
						})
					}
				}

			},

			getPhone(val, dazi_join_user) {
				console.log(dazi_join_user)
				if (dazi_join_user.length) {
					// 如果有长度还有判断 是否是自己参与了 没长度肯定没参与

					const res = dazi_join_user.some((item) => {
						return item.uid == this.userInfo.id
					})
					console.log(res)
					this.isHost = this.isHostFn(this.daziInfoObject.uid, this.userInfo.id)
					if (res) {
						this.$sun.phone(val)
					} else if (this.isHost) {
						this.$sun.phone(val)
					} else {
						uni.showModal({
							title: '提示',
							content: '报名后才可以获取手机号信息请参与报名再来获取手机号信息',
							success: async (res) => {
								if (res.confirm) {


								} else if (res.cancel) {

								}
							}
						});
					}

				} else {
					this.isHost = this.isHostFn(this.daziInfoObject.uid, this.userInfo.id)
					if (this.isHost) {
						this.$sun.phone(val)
					} else {
						uni.showModal({
							title: '提示',
							content: '报名后才可以获取手机号信息请参与报名再来获取手机号信息',
							success: async (res) => {
								if (res.confirm) {


								} else if (res.cancel) {

								}
							}
						});
					}

				}

			},
			getWechat(val, dazi_join_user) {
				// 判断当前是否有报名
				if (dazi_join_user.length) {
					// 如果有长度还有判断 是否是自己参与了 没长度肯定没参与

					const res = dazi_join_user.some((item) => {
						return item.uid == this.userInfo.id
					})
					console.log(res)
					this.isHost = this.isHostFn(this.daziInfoObject.uid, this.userInfo.id)
					if (res) {
						uni.setClipboardData({
							data: val
						});
					} else if (this.isHost) {
						uni.setClipboardData({
							data: val
						});
					} else {
						uni.showModal({
							title: '提示',
							content: '报名后才可以获取微信号信息请参与报名再来获取微信号信息',
							success: async (res) => {
								if (res.confirm) {


								} else if (res.cancel) {

								}
							}
						});
					}

				} else {
					this.isHost = this.isHostFn(this.daziInfoObject.uid, this.userInfo.id)
					// 如果是自己可以查看
					if (this.isHost) {
						uni.setClipboardData({
							data: val
						});
					} else {
						uni.showModal({
							title: '提示',
							content: '报名后才可以获取微信号信息请参与报名再来获取微信号信息',
							success: async (res) => {
								if (res.confirm) {


								} else if (res.cancel) {

								}
							}
						});
					}

				}


			},
			oneClickKicking(id) {

				// 掉接口
				uni.showModal({
					title: '提示',
					content: '是否要一键踢掉所以人',
					success: async (res) => {
						if (res.confirm) {

							const result = await this.$http.post({
								url: this.$api.kickAllUser,
								data: {

									id: id,


								},
								headers: {
									'Authorization': this.userInfo.token
								}

							})
							if (result.code == 0) {

								this.$sun.toast(result.message, 'none')

								setTimeout(() => {
									this.daziInfoFn(this.id)
								}, 500)

							} else {

								this.$sun.toast(result.message, 'none')
							}
						} else if (res.cancel) {

						}
					}
				});
			},

			async daziInfoFn(id) {
				const res = await this.$http.post({
					url: this.$api.daziInfo,
					data: {

						id: id

					},
					headers: {
						'Authorization': this.userInfo.token
					}

				})

				if (res.code == 0) {

					this.daziInfoObject = res.data
					console.log(this.daziInfoObject)

					this.daziInfoObject.expire_timeObject = JSON.parse(JSON.stringify(this.formatTimeDifference(this
						.daziInfoObject.expire_time)))

					this.daziInfoObject.label = this.daziInfoObject.label.split(",")
					const imgList = res.data.cover_img.split(",")
					this.listPoster = imgList.map(item => {
						return {
							img: item
						}
					})

					// 判断当前是否是搭主
					this.isHost = this.isHostFn(this.daziInfoObject.uid, this.userInfo.id)
					// 这里判断是否已经加入过了
					if (this.daziInfoObject.dazi_join_user.length) {
						const res = this.daziInfoObject.dazi_join_user.some((item) => {
							return item.uid == this.userInfo.id
						})
						if (res) {
							this.joinFeeBol = false
						} else {
							this.joinFeeBol = true
						}
					}
					// 需要判断当前的搭子是否满员
					if (this.daziInfoObject.sex == 1) {
						if (this.daziInfoObject.dazi_join_user.length == this.daziInfoObject.people_number) {
							this.isFullStarffed = true
						} else {
							this.isFullStarffed = false
						}
					} else {
						if (this.daziInfoObject.dazi_join_user.length == (this.daziInfoObject.woman_number + this
								.daziInfoObject.man_number)) {
							this.isFullStarffed = true
						} else {
							this.isFullStarffed = false
						}
					}

					// 判断当前男生参加了多少 女生参加了多少
					if (this.daziInfoObject.sex == 2) {
						let counts = this.daziInfoObject.dazi_join_user.reduce((acc, curr) => {
							if (curr.sex === 1) {
								acc.sex1++;
							} else if (curr.sex === 2) {
								acc.sex2++;
							}
							return acc;
						}, {
							sex1: 0,
							sex2: 0
						})

						this.joinMan = counts.sex1
						this.joinWoman = counts.sex2
					}

					console.log(this.isHost)



				} else {

					this.$sun.toast(resPoster.message, 'none')
				}
			},
			isHostFn(id, uid) {

				if (id == uid) {
					return true
				} else {
					return false
				}

			},
			formatTimeDifference(timestamp) {
				// 获取当前时间的时间戳（以秒为单位）
				const currentTimestamp = Math.floor(Date.now() / 1000);

				// 计算时间差（以秒为单位）
				let timeDifference = timestamp - currentTimestamp;

				// 计算天数
				const days = Math.floor(timeDifference / (24 * 60 * 60));
				timeDifference %= (24 * 60 * 60);

				// 计算小时
				const hours = Math.floor(timeDifference / (60 * 60));
				timeDifference %= (60 * 60);

				// 计算分钟
				const minutes = Math.floor(timeDifference / 60);

				// 剩余的秒数
				const seconds = timeDifference % 60;

				return {
					days: days,
					hours: hours,
					minutes: minutes,
					seconds: seconds
				};
			},
			// 订阅消息
			async templateTpo() {
				
					wx.requestSubscribeMessage({
						tmplIds: ['vp1A1s2ctyxDgZc-TLli_-gBlxN8yTZmXhp_rCtHNmc'],
						success: res => { //成功、
							if (res[Object.keys(res)[0]] == "accept") {
								console.log(res)
								this.$sun.toast("成功订阅")
							} else {
								uni.showModal({
									title: "温馨提示",
									content: "点击右上角的「...」按钮，找到「订阅消息」相关选项，并设定为「接收」状态方可再次订阅"
								})
							}
						},
						fail: err => { //失败
							this.$sun.toast("订阅消息配置失败");
						}
					})
			
			},
			async joiningFeeFn(id) {
				if(uni.getStorageSync("userInfo").disable==0){
					this.$sun.toast('当前用户已经被拉黑','none')
				}else if(this.daziInfoObject.sex==2&&this.daziInfoObject.woman_participants_number>=this.daziInfoObject.woman_number&&uni.getStorageSync("userInfo").sex==2){
					// 需要判断参加的 大于性别是否超出限制
					
					this.$sun.toast('当前参与的女生超过限制','none')
				}else if(this.daziInfoObject.sex==2&&this.daziInfoObject.man_participants_number>=this.daziInfoObject.man_number&&(uni.getStorageSync("userInfo").sex==1)){
					// 需要判断参加的 大于性别是否超出限制
					
					this.$sun.toast('当前参与的男生超过限制','none')
				}else{
					if (uni.getStorageSync("userInfo").phone) {
						const res = await this.$http.post({
							url: this.$api.joinDazi,
							data: {
					
								dz_id: id
					
							},
							headers: {
								'Authorization': this.userInfo.token
							}
					
						})
					
						if (res.code == 0) {
					        // this.templateTpo()
					
					
							this.$sun.toast(res.message, 'none')
							uni.removeStorageSync('shareType')
							uni.removeStorageSync('detailId')
							setTimeout(() => {
								if (this.shareType == 1) {
									this.$sun.navRe('/pages/home/home', {
										currentIndex: uni.getStorageSync("returnDazi") ? uni
											.getStorageSync("returnDazi") : 0
									});
								} else {
									this.$sun.navBack()
								}
					
							}, 500)
					
						} else {
					
							this.$sun.toast(res.message, 'none')
					
							setTimeout(() => {
								if (res.message == '余额不足请充值') {
									if (this.isAndroid) {
										this.$sun.navGo('/pagesA/personalCenter/onlineRecharge')
									} else {
										this.$sun.navGo('/pagesA/personalCenter/contactUs')
									}
					
								}
							}, 1500)
						}
					} else {
						// this.$sun.toast('当前未实名认证,请认证在来参加', 'none')
						// setTimeout(() => {
						// 	this.$sun.navGo('/pagesA/personalCenter/realAuthentication')
						// }, 1500)
						this.$refs.phoneLogin.show({
							anim: 'bottom',
							position: 'bottom',
							shadeClose: true, //false使用户不能点击其它关闭页面
							topclose: false,
							// shade:false,
							zIndex: 100000
						
						});
					}
				}
			}
		}
	}
</script>

<style lang="less" scoped>
	.phoneBtn{
		margin-top: 40rpx;
		
		height: 100rpx;
		border-radius: 130rpx;
		color: #fff;
		background: rgb(120, 93, 246);
	
	}
	.getPhone {
		height: 96rpx;
		border-radius: 124rpx;
	    padding-left: 20rpx;
		background: #f5f5f9;
		position: relative;
	
		.ckPhone {
			height: 96rpx;
			line-height: 100rpx;
			width: 220rpx;
			background-color: transparent;
			color: #000;
		}
		
		.verificationCode {
			z-index: 999;
			position: absolute;
			right: 0;
			text-align: center;
			width: 170rpx;
			height: 65rpx;
			line-height: 65rpx;
			border-radius: 100rpx;
			font-size: 20rpx;
			background: #7D5CF7;
			color: #fff;
		}
	}
	.daziDetailPopup {
		border-radius: 20rpx 20rpx 0rpx 0rpx;
		
		.dw{
			position: relative;
			
			.dwSex{
				position: absolute;
				bottom: 0;
				z-index: 88;
				left: -12rpx;
			}
		}
		.noVip {
			width: 136rpx;
			height: 40rpx;
			margin-left: 10rpx;
		}
		
		.Vip {
			width: 136rpx;
			height: 40rpx;
			margin-left: 10rpx;
		}
		
	}

	.detailsGenderImg {
		width: 58rpx;
		height: 58rpx;
	}

	.poster {
		width: 780rpx;
		height: 630rpx;
	}

	.sexIcon {
		width: 36rpx;
		height: 36rpx;
	}

	.line {
		width: 8rpx;
		height: 34rpx;
		background: rgb(108, 133, 252);
		margin-right: 10rpx;
	}

	.flex-center() {
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.v-p-share {
		padding: 2rpx 2rpx 0 2rpx;

		.v-m-width {
			margin-right: 40rpx;

			.pt_img {
				width: 50rpx;
				height: 50rpx;
				margin-right: -25rpx;
				border-radius: 50%;
			}
		}

		.v-share-friend {
			text {
				color: #294d7d;
				font-size: 24rpx;
				padding-right: 50rpx;
			}

			view {
				color: #ffffff;
				width: 154rpx;
				height: 58rpx;
			}
		}

		.v-share-friend2 {
			text {
				color: #294d7d;
				font-size: 24rpx;
			}
		}
	}

	.moreActiveButton {


		background-color: #fff;

		.moreActiveButton {


			background-color: #fff;


			.add {
				height: 100rpx;
				color: #6568F6;
				font-size: 28rpx;
				font-family: Inter;

				.flex-center();
				border: 2rpx solid #f7f7f7;


			}

			.delete {
				.flex-center();
				height: 100rpx;


				color: #FF4636;
				font-size: 28rpx;
				font-family: Inter;
				box-shadow: 2rpx 2rpx 2rpx 30rpx 30rpx rgba(238, 238, 238, 1.0);
			}


		}

		.add {
			height: 100rpx;
			color: #6568F6;
			font-size: 28rpx;
			font-family: Inter;

			.flex-center();
			border: 1px solid #f7f7f7;


		}

		.delete {
			.flex-center();
			height: 100rpx;


			color: #FF4636;
			font-size: 28rpx;
			font-family: Inter;
			box-shadow: 2rpx 2rpx 2rpx 30rpx 30rpx rgba(238, 238, 238, 1.0);
		}


	}

	// .bgIndex {
	// 	width: 780rpx;
	// 	height: 630rpx;
	// 	background-repeat: no-repeat;
	// 	background-size: cover;
	// 	background-image: url('http://yunhunjian123.oss-cn-shanghai.aliyuncs.com/2024-06-08/9aef0202406081058583262.png');

	// }

	.addTieziBtn {
		width: 650rpx;
		height: 100rpx;
		border-radius: 130rpx;
		color: #fff;
		background: rgb(120, 93, 246);
		position: fixed;
		bottom: 20rpx;
		transform: translate(7%);
		z-index: 899;
	}

	.addDaZiBtn {
		position: fixed;
		width: 95%;
		bottom: 20rpx;
		transform: translate(3%);
		z-index: 899;

		.editBtn {
			margin-right: 10rpx;
			width: 234rpx;
			height: 100rpx;
			box-sizing: border-box;
			border: 2rpx solid rgb(123, 92, 246);
			border-radius: 130rpx;
			color: #7B5CF6;
			background: rgb(255, 255, 255);
		}

		.deadlineRegistration {
			width: 404rpx;
			height: 100rpx;
			border-radius: 130rpx;
			color: #fff;
			background: rgb(123, 92, 246);
		}
	}

	.female {
		width: 90rpx;
		height: 36rpx;
		border-radius: 20rpx;
		color: #fff;
		background: #FA5799;

		.femaleImg {
			width: 18rpx;

			margin-right: 10rpx;
		}
	}

	.HomepageBtn {
		width: 250rpx;
		height: 100rpx;
		border-radius: 130rpx;
		color: #fff;
		background: rgb(120, 93, 246);
		position: fixed;
		bottom: 20rpx;
		transform: translate(7%);
		z-index: 899;
	}

	.HomepageBtn-active {
		width: 660rpx;
		height: 100rpx;
		border-radius: 130rpx;
		color: #fff;
		background: rgb(120, 93, 246);
		position: fixed;
		bottom: 20rpx;
		transform: translate(7%);
		z-index: 899;
	}


	.male {
		width: 90rpx;
		height: 36rpx;
		border-radius: 20rpx;
		color: #fff;
		background: rgb(1, 145, 255);

		.femaleImg {
			margin-top: 5rpx;
			width: 20.96rpx !important;
			height: 20.96rpx !important;
			margin-right: 15rpx;
		}

		.maleImg {
			width: 18rpx;
			margin-right: 10rpx;
		}
	}

	.img {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		margin-right: 8rpx;
	}

	.threePoints {
		width: 32rpx;
		height: 32rpx;
	}

	.wxImg {
		width: 56rpx;
		height: 56rpx;
	}

	.tagTitlePink {
		padding: 10rpx 20rpx;
		height: 36rpx;
		border-radius: 12rpx 12rpx 24rpx 12rpx;
		font-size: 20rpx;
		color: #F95CEF;
		background: #FFF2F8;
		margin-right: 5rpx;
	}

	.tagImg {
		width: 118rpx;
		height: 38rpx;
	}

	.tagTitleOrange {
		padding: 10rpx 20rpx;
		height: 36rpx;
		border-radius: 12rpx 12rpx 24rpx 12rpx;
		font-size: 20rpx;
		color: rgb(238, 100, 41);
		background: rgba(238, 100, 41, 0.13);
		;
		margin-right: 5rpx;
	}

	.addImg {
		width: 30.02rpx;
		height: 30.02rpx;
	}








	.share {
		position: fixed;
		color: #FFFFFF;
		right: 0;
		bottom: 190rpx;
		background: linear-gradient(to bottom right, #FE726B, #FE956B);
		padding: 10rpx 10rpx 10rpx 20rpx;
		border-top-left-radius: 50px;
		border-bottom-left-radius: 50px;
		box-shadow: 0 0 20upx rgba(0, 0, 0, .09);
	}

	.cancel {
		width: 100vw;
		padding: 30rpx;
		text-align: center;
		background: #FFFFFF;
		color: red;
		font-weight: bold;
		font-size: 30rpx;
	}

	.md-content {
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		padding: 50rpx 0;
	}

	.md-content-item {
		margin: 0 70rpx;
		position: relative;
	}

	.md-content-item image {
		width: 100rpx;
		height: 100rpx;
	}

	.md-content-item view {
		margin-top: 15rpx;
		font-size: 28rpx;
	}

	.sharebtn {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		opacity: 0;
	}
</style>